﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<TemplateWeb.Models.ViewModels.GroupViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript">        $(document).ready(function () { slideShow(); });</script>
    <script type="text/javascript" src="../../Scripts/slideshow.js"></script>
    <div class="slideshow" id="slideshow">
<% foreach (var item in Model.SachModel.GetModel.LstObjModel)
   {
        if (item.TieuBieu.Value)
        {%>
	    <a href="<%= Url.Action("ChiTietSach", "Home", new { id = item.ID }) %>" class="" style="opacity: 0; ">
		    <img src="../../Content/Images/Items/<%= item.HinhMinhHoa %>" alt="<%= item.TenSach %>" width="700" height="330" title="" rel="">
	    </a>
     <% }
   } %>
	    <div class="caption" style="width: 700px; opacity: 0.6; height: 80px; display: block; "><div class="content" style="opacity: 0.7; "></div></div>
    </div>		
    <div class="box_sachsapphathanh">
        <div class="title"><a href="#" title="Sách sắp phát hành">Sách sắp phát hành</a></div>
            <div class="content">
        <% 
            var sachSapPhatHanh = Model.LoaiSachModel.GetModel.LstObjModel.First(n => n.TenLoaiSach.ToUpper().Contains("SẮP PHÁT HÀNH"));
        %>
        <% if(sachSapPhatHanh != null)
           {
               var lst = sachSapPhatHanh.Sach.Take(4).ToList();
        %>
            <% foreach(var item in lst)
               { %>
                <div class="pitem">
                    <a href="<%= Url.Action("ChiTietSach", "Home", new { id = item.ID }) %>" title="<%= item.TenSach %>">
                        <img src="../../Content/Images/Items/<%= item.HinhMinhHoa %>" alt="<%= item.HinhMinhHoa %>" width="130" height="177">
                    </a>
                </div>    
            <% } %>
        <% } %>    
            </div>   
    </div>        
    <div class="box_content">
        <%
            var sachMoi = Model.LoaiSachModel.GetModel.LstObjModel.First(n => n.TenLoaiSach.ToUpper().Contains("MỚI")); 
        %>
	    <div class="title"><span><a href="#" title="Sách mới">Sách mới</a></span>
            <div class="bg"><img src="../../Content/Images/Home/bg_title_right.png"></div>
        </div>
	    <div class="content">
        <% if (sachMoi != null)
            {
               var lst = sachMoi.Sach.Where(n => !n.BestSeller.Value && !n.TieuBieu.Value).Take(4).ToList(); 
        %>
            <% for (int i = 0; i < lst.Count; i++)
               { %>
               <% if (i == 0)
                  { %>
    	        <div class="fitem">
                    <div class="img">
                        <a href="<%= Url.Action("ChiTietSach", "Home", new { id = lst[i].ID }) %>" title="<%= lst[i].TenSach %>">
                            <img src="../../Content/Images/Items/<%= lst[i].HinhMinhHoa %>" alt="<%= lst[i].TenSach %>" width="114" height="151">
                        </a>
                    </div>
                    <div class="text">
                        <a href="<%= Url.Action("ChiTietSach", "Home", new { id = lst[i].ID }) %>" title="<%= lst[i].TenSach %>" class="name"><%= lst[i].TenSach %></a><br>
                        <p>
                            <%= Html.Truncate(lst[i].NoiDungRutGon, WebConfiguration.SachSortDescription) %>
                        </p>
                        <a href="<%= Url.Action("ChiTietSach", "Home", new { id = lst[i].ID }) %>" title="Xem tiếp" class="next">Xem tiếp</a>
                    </div>
                </div>
               <% }
                  else
                  { %>
                <div class="litem">
                    <div class="img">
                        <a href="<%= Url.Action("ChiTietSach", "Home", new { id = lst[i].ID }) %>" title="<%= lst[i].TenSach %>">
                            <img src="../../Content/Images/Items/<%= lst[i].HinhMinhHoa %>" alt="<%= lst[i].TenSach %>" width="39" height="42">
                        </a>
                    </div>
                    <div class="text">
                        <a href="<%= Url.Action("ChiTietSach", "Home", new { id = lst[i].ID }) %>" title="Cách sống"><%= lst[i].TenSach %></a>
                    </div>
                </div>
               <% } %>
            <% } %>
        <% } %>
        </div>
        <div class="border">
        </div>
    </div>   
<%
    var lstLoaiSach = Model.LoaiSachModel.GetModel.LstObjModel.Where(n => !n.TenLoaiSach.ToUpper().Contains("SẮP PHÁT HÀNH") && !n.TenLoaiSach.ToUpper().Contains("MỚI"));
    foreach (var loaisach in lstLoaiSach)
    {
%>     
    <div class="box_content">
	    <div class="title"><span><a href="#" title="Tin Thai Ha Books"><%= loaisach.TenLoaiSach %></a></span>
            <div class="bg">
                <img src="../../Content/Images/Home/bg_title_right.png">
            </div>
        </div>
	    <div class="content">
            <% 
                var lst = loaisach.Sach.Where(n => !n.BestSeller.Value && !n.TieuBieu.Value).Take(4).ToList(); 
            %>
            <% for (int i = 0; i < lst.Count; i++)
               { %>
               <% if (i == 0)
                  { %>
    	        <div class="fitem">
                    <div class="img">
                        <a href="<%= Url.Action("ChiTietSach", "Home", new { id = lst[i].ID }) %>" title="<%= lst[i].TenSach %>">
                            <img src="../../Content/Images/Items/<%= lst[i].HinhMinhHoa %>" alt="<%= lst[i].TenSach %>" width="114" height="151">
                        </a>
                    </div>
                    <div class="text">
                        <a href="<%= Url.Action("ChiTietSach", "Home", new { id = lst[i].ID }) %>" title="<%= lst[i].TenSach %>" class="name"><%= lst[i].TenSach %></a><br>
                        <p>
                            <%= Html.Truncate(lst[i].NoiDungRutGon, WebConfiguration.SachSortDescription) %>
                        </p>
                        <a href="<%= Url.Action("ChiTietSach", "Home", new { id = lst[i].ID }) %>" title="Xem tiếp" class="next">Xem tiếp</a>
                    </div>
                </div>
               <% }
                  else
                  { %>
                <div class="litem">
                    <div class="img">
                        <a href="<%= Url.Action("ChiTietSach", "Home", new { id = lst[i].ID }) %>" title="<%= lst[i].TenSach %>">
                            <img src="../../Content/Images/Items/<%= lst[i].HinhMinhHoa %>" alt="<%= lst[i].TenSach %>" width="39" height="42">
                        </a>
                    </div>
                    <div class="text">
                        <a href="<%= Url.Action("ChiTietSach", "Home", new { id = lst[i].ID }) %>" title="Cách sống"><%= lst[i].TenSach %></a>
                    </div>
                </div>
               <% } %>
            <% } %>
        </div>
        <div class="border">
        </div>
    </div>
<% } %>
    <div class="box_content">
	    <div class="title">
            <span><a href="#" title="Góc chia sẻ">Góc chia sẻ</a></span>
            <div class="bg">
                <img src="../../Content/Images/Home/bg_title_right.png" />
            </div>
        </div>
	    <div class="content">
    	    <% 
                var lstGocChiaSe = Model.GocChiaSeModel.GetModel.LstObjModel.Where(n => n.DaDuyet.Value).Take(4).ToList(); 
            %>
            <% for (int i = 0; i < lstGocChiaSe.Count; i++)
               { %>
               <% if (i == 0)
                  { %>
    	        <div class="fitem">
                    <div class="img">
                        <a href="<%= Url.Action("ChiTietChiaSe", "Home", new { id = lstGocChiaSe[i].ID }) %>" title="<%= lstGocChiaSe[i].TieuDe %>">
                            <img src="../../Content/Images/Items/<%= lstGocChiaSe[i].HinhMinhHoa %>" alt="<%= lstGocChiaSe[i].TieuDe %>" width="114" height="151">
                        </a>
                    </div>
                    <div class="text">
                        <a href="<%= Url.Action("ChiTietGocChiaSe", "Home", new { id = lstGocChiaSe[i].ID }) %>" title="<%= lstGocChiaSe[i].TieuDe %>" class="name"><%= lstGocChiaSe[i].TieuDe %></a><br>
                        <p>
                            <%= Html.Truncate(lstGocChiaSe[i].NoiDungRutGon, WebConfiguration.SachSortDescription) %>
                        </p>
                        <a href="<%= Url.Action("ChiTietGocChiaSe", "Home", new { id = lstGocChiaSe[i].ID }) %>" title="Xem tiếp" class="next">Xem tiếp</a>
                    </div>
                </div>
               <% }
                  else
                  { %>
                <div class="litem">
                    <div class="img">
                        <a href="<%= Url.Action("ChiTietGocChiaSe", "Home", new { id = lstGocChiaSe[i].ID }) %>" title="<%= lstGocChiaSe[i].TieuDe %>">
                            <img src="../../Content/Images/Items/<%= lstGocChiaSe[i].HinhMinhHoa %>" alt="<%= lstGocChiaSe[i].TieuDe %>" width="39" height="42">
                        </a>
                    </div>
                    <div class="text">
                        <a href="<%= Url.Action("ChiTietGocChiaSe", "Home", new { id = lstGocChiaSe[i].ID }) %>" title="Cách sống"><%= lstGocChiaSe[i].TieuDe %></a>
                    </div>
                </div>
               <% } %>
            <% } %>
        </div>
    </div>
</asp:Content>
